package com.cn.zmc.design.builder.service.impl;

import com.cn.zmc.design.builder.service.BuilderService;
import com.cn.zmc.design.builder.service.domain.RiskData;
import com.cn.zmc.design.builder.service.domain.RiskOrder;
import com.cn.zmc.design.builder.service.domain.RiskPhone;
import org.springframework.stereotype.Service;


@Service
public class BuilderServiceImpl implements BuilderService {

    RiskData riskData;

    @Override
    public BuilderService create() {
        this.riskData = new RiskData();
        return this;
    }

    @Override
    public BuilderService order(RiskOrder riskOrder) {
        riskOrder.setOrderId((int)(Math.random() * 100));
        riskOrder.setUserId((int)(Math.random() * 100));
        this.riskData.setOrder(riskOrder);
        return this;
    }

    @Override
    public BuilderService phone(RiskPhone riskPhone) {
        riskPhone.setId((long)(Math.random() * 100));
        this.riskData.setPhone(riskPhone);
        return this;
    }

    @Override
    public RiskData build() {
        return this.riskData;
    }
}
